//
//  EMResponseModel.m
//  EasyMoney
//
//  Created by zh on 2019/12/14.
//  Copyright © 2019 zh. All rights reserved.
//

#import "EMResponseModel.h"

@implementation EMResponseModel

// 直接添加以下代码即可自动完成
- (void)encodeWithCoder:(NSCoder *)aCoder { [self yy_modelEncodeWithCoder:aCoder]; }
- (id)initWithCoder:(NSCoder *)aDecoder { self = [super init]; return [self yy_modelInitWithCoder:aDecoder]; }
- (id)copyWithZone:(NSZone *)zone { return [self yy_modelCopy]; }
- (NSUInteger)hash { return [self yy_modelHash]; }
- (BOOL)isEqual:(id)object { return [self yy_modelIsEqual:object]; }
- (NSString *)description { return [self yy_modelDescription]; }


+ (NSDate *)dateTransformFromValue:(id)value
{
    if ([value isKindOfClass:[NSString class]]) {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
        NSLocale *zhLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
        formatter.locale = zhLocale;
        return [formatter dateFromString:(NSString *)value];
    }else if ([value isKindOfClass:[NSNumber class]]) {
        double createdTime = [(NSNumber*)value doubleValue];
        return [NSDate dateWithTimeIntervalSince1970:createdTime];
    }else{
        return nil;
    }
}

@end
